<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp"%>
<script type="text/javascript" >

$(function(){
	$('#workMgmtGrid').datagrid({
	    url: ctx + '/pof/WorkMgmt!findPage.action',
	    fit: true,
	    pagination: true,
	    initload: false,
	    queryParams:{},
	    toolbar:'#button_index',
	    rownumbers: true,
	    singleSelect:true,
	    idField: 'sid',
	    onLoadSuccess :function(data){
	    		
	    },
	    onDblClickRow :function(rowIndex,rowData){
	    	
	    }
	});
	
	$('#stitle').searchbox({
	    searcher:function(value,name){
	    	if($('#searchYear').val()==''||$('#searchMonth').val()==''){
	    		$.messager.show({
					msg : '请输入年月'
				});
	    		return;
	    	}
	    	$('#workMgmtGrid').datagrid('reload',{
	    		'entity.cname':value,
	    		'entity.sendYear':$('#searchYear').val(),
	    		'entity.sendMonth':$('#searchMonth').val()
	    	});
	    },
	    prompt:'请输入姓名'
	});
	
	$('#workAdd').bind('click',function(){
		CQOA.load('extendDiv',ctx+'/pof/WorkMgmt!operate.action',{},function(){
			CQOA.hideDiv('mainDiv');
			CQOA.showDiv('extendDiv');
		});
	});
	
	$('#workEdit').bind('click',function(){
		var row = $('#workMgmtGrid').datagrid('getSelected');
		if (!row) {
			$.messager.show({
				msg : '请选择一条数据'
			});
			return false;
		}
		CQOA.load('extendDiv',ctx+'/pof/WorkMgmt!operate.action',{'entity.sid':row.sid},function(){
			CQOA.hideDiv('mainDiv');
			CQOA.showDiv('extendDiv');
		});
	});
	
	$('#workImprot').bind('click',function(){
		
	});
	
	$('#workLoad').bind('click',function(){
		
	});
	
	$('#workDel').bind('click',function(){
		var row = $('#workMgmtGrid').datagrid('getSelected');
		if (!row) {
			$.messager.show({
				msg : '请选择一条数据'
			});
			return false;
		}
		$.messager.confirm('提示信息','你确定要删除这条数据?',function(res){
			if(res){
				postcommit(ctx+'/pof/WorkMgmt!delete.action',{'entity.sid':row.sid},function(o){
					if(o.success){
						$('#workMgmtGrid').datagrid('reload');
					}
					$.messager.show({
						msg : o.msg
					});
				});
			}
		});
	});
	
	
});

function comeback(){
	CQOA.hideDiv('extendDiv');
	CQOA.showDiv('mainDiv');
};

</script>
<div id="mainDiv" class="easyui-layout" fit="true" border="false">
	        <div id="easyui-title" style="display:none">
	            	工资管理
	        </div>
           <div class="top_toolbar_div" region="north" border="false">
           	        年<input id="searchYear" type="text" class="easyui-validatebox" validType="number[0,4]"  style="width: 100px;">   
           	        月<input id="searchMonth" type="text" class="easyui-validatebox" validType="number[0,2]"  style="width: 100px;">             
               <input id="stitle" style="width:300px" ></input>
            </div>
             <div id="button_index" class="top_toolbar_button_div" border="false">
                    <a href="#" class="easyui-linkbutton" id="workAdd">新增</a>
                    <a href="#" class="easyui-linkbutton" id="workEdit">修改</a>
                    <a href="#" class="easyui-linkbutton" id="workImprot">导入</a>
                    <a href="#" class="easyui-linkbutton" id="workLoad">导出</a>
                    <a href="#" class="easyui-linkbutton" id="workDel">删除</a>
                </div>
            <div  region="center" border="false">
	           <table id="workMgmtGrid" title="工资列表" border="false" fit="true" >
	               			<thead>
			                   <tr>
			                   	  <!-- 
			                      <th field="sid"  width="50">SID</th>
			                      <th checkbox="true"  width="50"></th>
			                      -->
			                      <th field="cname"  width="100">姓名</th>
			                      <th field="sendYear"  width="80">年</th>
			                      <th field="sendMonth"  width="80">月</th>
			                      <th field="payMoney"  width="100">工作</th>
			                      <th field="payMangce"  width="100">绩效</th>
			                      <th field="payAll"  width="100">合计</th>
			                   </tr>
	               			</thead>
	       	 	</table>
           </div>
</div>
<div id="extendDiv" class="easyui-panel" style="display:none;" fit="true" border="false"></div>
<div id="targetPopup" modal="true" class="easyui-window" closed="true" style="height: 480px; width: 700px" title="选择人员"></div>


